Skip to content

feat(ci): replace pre-commit into prek#17703

Merged
aldy505 merged 3 commits into
masterfrom
aldy505/ci/migrate-pre-commit-prek
May 19, 2026
Merged

feat(ci): replace pre-commit into prek#17703
aldy505 merged 3 commits into
masterfrom
aldy505/ci/migrate-pre-commit-prek

Conversation

@aldy505
Copy link
Copy Markdown
Collaborator

@aldy505 aldy505 commented May 10, 2026

DESCRIBE YOUR PR

Faster execution than pre-commit. The sentry and self-hosted repo are already using it right now.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@vercel
Copy link
Copy Markdown

vercel Bot commented May 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 19, 2026 8:56am
sentry-docs Ready Ready Preview, Comment May 19, 2026 8:56am

Request Review

@aldy505 aldy505 requested review from BYK, jaffrepaul and sfanahata May 10, 2026 13:51
Comment thread .pre-commit-config.yaml Outdated
Comment thread .pre-commit-config.yaml
Comment on lines +34 to +44
exclude: 'node_modules'
types: [text]
args: ['--write']
- id: eslint
entry: node_modules/.bin/eslint
name: eslint
description: This hook runs eslint on JavaScript and TypeScript files
entry: eslint
language: node
files: '\.[jt]sx?$'
exclude: 'node_modules'
types: [text]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The local prettier and eslint hooks use language: node without additional_dependencies, which will cause them to fail with 'executable not found' errors during commits.
Severity: MEDIUM

Suggested Fix

To fix this, either change the language to language: system and point the entry to the project's local node_modules/.bin executables, or add additional_dependencies: [prettier, eslint] to the hook definitions to ensure the tools are installed in the isolated hook environment.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: .pre-commit-config.yaml#L28-L44

Potential issue: The `pre-commit` configuration for the local `prettier` and `eslint`
hooks specifies `language: node`. This creates an isolated, empty Node.js environment
for the hooks. Because `additional_dependencies` are not provided, the `prettier` and
`eslint` packages will not be installed into this environment. As a result, when a
developer attempts to commit a file that triggers these hooks, the `pre-commit`
framework will be unable to find the `prettier` or `eslint` executables, causing the
hook to fail and blocking the commit.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor

@sfanahata sfanahata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Also seems like that sentry bot potential bug is a false positive.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bbf8b56. Configure here.

Comment thread .pre-commit-config.yaml
description: This hook runs Prettier on JavaScript and TypeScript files
entry: prettier
language: node
files: '\.[jt]sx?$'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier hook file pattern excludes markdown and mjs

Medium Severity

The new prettier hook's files pattern '\.[jt]sx?$' only matches .js, .jsx, .ts, and .tsx files. However, the project's CI lint command (lint:prettier in package.json) checks {md,mdx,ts,tsx,js,jsx,mjs} files, and prettier.config.js has explicit overrides for *.md and *.mdx. This means the pre-commit hook will no longer catch formatting issues in markdown, MDX, or .mjs files before commit — developers will only learn about them when CI fails.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bbf8b56. Configure here.

@aldy505 aldy505 enabled auto-merge (squash) May 19, 2026 08:48
@aldy505 aldy505 merged commit 78baa78 into master May 19, 2026
21 checks passed
@aldy505 aldy505 deleted the aldy505/ci/migrate-pre-commit-prek branch May 19, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants